<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui">
<h:head>
	<title>insert title here</title>
	<meta http-equiv="Content-Type" content="text/html;charset=utf-8"></meta>
</h:head>
<h:body>
	<ui:composition template="/templates/khungchinh.xhtml">
		<ui:define name="tieudetrang">
            #{msgs.tieudetrangadmin}
         </ui:define>
		<ui:define name="javascrip">
			<h:outputScript library="javascrip" name="admin.js"
				rendered="#{!beanSanPham.capnhat}" />
			<h:outputScript library="javascrip" name="update.js"
				rendered="#{beanSanPham.capnhat}" />
		</ui:define>
		<ui:define name="phandau">
			<div class="daude">#{msgs.loichaotrangadmin}
			</div>
			
		</ui:define>
		<ui:define name=""></ui:define>
		<ui:define name="menungang">
		<h:form>
			<p:tabMenu activeIndex="0">
				<p:menuitem value="Thêm Sản Phẩm" url="#" styleClass="menuitem" />
				<p:menuitem value="Quản Lý Sản Phẩm"
					url="quanlysanpham.xhtml?reset=true" styleClass="menuitem" />
				<p:menuitem value="Quản Lý Hóa Đơn" url="quanlyhoadon.xhtml"
					styleClass="menuitem" />
				<p:menuitem value="Log Out" action="#{beanSanPham.logout}"
					styleClass="menuitem" />
			</p:tabMenu>
			</h:form>
		</ui:define>
		<ui:define name="noidung">
			<div id="nhaplieu">
				<fieldset>
					<legend>
						<em>#{msgs.tieudenhaplieu}</em>
					</legend>
					<h:form enctype="multipart/form-data" acceptcharset="utf-8">
						<p:messages id="messages" showDetail="true" autoUpdate="true"
							closable="true" />
							<p:ajaxStatus style="width:25px;height:25px;"
								id="ajaxStatusPanel">
								<f:facet name="start">
									<h:graphicImage value="/resources/images/progress.gif" />
								</f:facet>

								<f:facet name="complete">
									<h:outputText value=""/>
								</f:facet>
				</p:ajaxStatus>
						<h:panelGrid columns="3">
							<h:outputText value="#{msgs.tenSanPham}"></h:outputText>
							
							
							<p:inputText value="#{beanSanPham.ten}" id="ten"
								 title="#{msgs.nhacnhoten}" rendered="#{!beanSanPham.capnhat}">
								<p:ajax event="blur" listener="#{beanSanPham.kiemtratrung}"
									update="messages"></p:ajax>
							</p:inputText>
							<p:watermark for="ten" value="Không bỏ trống" />
							
							
							<h:outputText value="#{beanSanPham.ten}"
								rendered="#{beanSanPham.capnhat}"></h:outputText>
         	#{msgs.gia}
         	<p:inputText value="#{beanSanPham.gia}" id="gia"
								title="#{msgs.nhacnhogia}" onkeypress="return digitonly(event)">
								<f:convertNumber pattern="###,###,###"></f:convertNumber>
								<f:ajax event="blur" render="@this"></f:ajax>
							</p:inputText>
							<p:watermark for="gia" value="Không bỏ trống" />
         	#{msgs.hang}
            <p:autoComplete id="hang" maxResults="5"
								value="#{beanSanPham.nsx}"
								completeMethod="#{beanSanPham.complete}"
								title="#{msgs.nhacnhoten}" />
								<p:watermark for="hang" value="Không bỏ trống" />
         	#{msgs.baoHanh}
         	<p:inputText value="#{beanSanPham.baoHanh}"></p:inputText>
         	<h:outputText></h:outputText>
         	#{msgs.cpu}
         	<p:inputText value="#{beanSanPham.cpu}"></p:inputText>
         	<h:outputText></h:outputText>
         	#{msgs.ram}
         	<p:inputText value="#{beanSanPham.ram}"></p:inputText>
         	<h:outputText></h:outputText>
         	#{msgs.hdd}
         	<p:inputText value="#{beanSanPham.hdd}"></p:inputText>
         	<h:outputText></h:outputText>
         	#{msgs.manHinh}
         	<p:inputText value="#{beanSanPham.manHinh}"></p:inputText>
         	<h:outputText></h:outputText>
         	#{msgs.doHoa}
         	<p:inputText value="#{beanSanPham.doHoa}"></p:inputText>
         	<h:outputText></h:outputText>
         	#{msgs.oDia}
         	<p:inputText value="#{beanSanPham.oDia}"></p:inputText>
         	<h:outputText></h:outputText>
         	#{msgs.wifi}
         	<p:inputText value="#{beanSanPham.wifi}"></p:inputText>
         	<h:outputText></h:outputText>
         	#{msgs.webcam}
         	<p:inputText value="#{beanSanPham.webcam}"></p:inputText>
         	<h:outputText></h:outputText>
         	#{msgs.pin}
         	<p:inputText value="#{beanSanPham.pin}"></p:inputText>
         	<h:outputText></h:outputText>
         	#{msgs.hdh}
         	<p:inputText value="#{beanSanPham.hdh}"></p:inputText>
         	<h:outputText></h:outputText>
         	#{msgs.hinh}
         	<p:fileUpload
								fileUploadListener="#{beanSanPham.handleFileUpload}"
								value="#{beanSanPham.fileUpload}" mode="simple" id="hinh" />
						</h:panelGrid>
						<br />
         #{msgs.khuyenMai} <br />
						<p:editor value="#{beanSanPham.khuyenMai}"></p:editor>
						<br />
						<div id="luusanpham">
							<p:commandButton actionListener="#{beanSanPham.upload}"
								rendered="#{!beanSanPham.capnhat}" value="#{msgs.luuSanPham}"
								onclick="return kiemtradieukienluu(this.form);"
								action="#{beanSanPham.luusanpham}"></p:commandButton>

							<p:commandButton rendered="#{beanSanPham.capnhat}"
								actionListener="#{beanSanPham.upload}" value="#{msgs.capnhat}"
								onclick="return kiemtradieukienluu(this.form);"
								action="#{beanSanPham.capnhatsanpham}"></p:commandButton>

							<h:commandLink rendered="#{beanSanPham.capnhat}"
								action="#{beanSanPham.xoasanpham}">
								<p:button value="#{msgs.xoa}">
								</p:button>
							</h:commandLink>

							<h:commandLink rendered="#{beanSanPham.capnhat}"
								action="#{beanSanPham.quaylai}">
								<p:button value="#{msgs.quaylai}"></p:button>
							</h:commandLink>
						</div>
					</h:form>
				</fieldset>
			</div>
			<div id="danhsachsanphammoi">
				<h:form>
					<p:dataList value="#{beanSanPham.danhSachSanPham1}" var="sanpham"
						id="listsanpham" paginator="true" rows="4" effectSpeed="fast"
						paginatorTemplate="{PreviousPageLink} {CurrentPageReport} {NextPageLink} {RowsPerPageDropdown}"
						rowsPerPageTemplate="4,8,12,16" type="none">

						<f:facet name="header">  
                #{msgs.danhsachsanphammoi}  
            		</f:facet>
						<h:commandLink action="#{beanSanPham.chitiet}">
							<p:graphicImage id="image" styleClass="hinhsanphammoi"
								value="/resources/images/hinhsanpham/#{sanpham.hinh}" />
							<f:setPropertyActionListener target="#{beanSanPham.sanpham}"
								value="#{sanpham}"></f:setPropertyActionListener>
						</h:commandLink>
						<p:tooltip for="image" styleClass="tooltip" showEffect="slide"
							hideEffect="slide">
							<h:panelGrid columns="2">
								<h:outputText value="#{msgs.tenSP}" style="font-weight: bold;"></h:outputText>
								<h:outputText value="#{sanpham.ten}" style="font-weight: bold;">

								</h:outputText>

								<h:outputText value="#{msgs.Gia}" style="font-weight: bold;"></h:outputText>
								<h:outputText value="#{sanpham.gia}">
									<f:convertNumber pattern="###,###,### VND"></f:convertNumber>
								</h:outputText>
							</h:panelGrid>
						</p:tooltip>
					</p:dataList>
				</h:form>
			</div>
		</ui:define>
	</ui:composition>
</h:body>

</html>